/*
 * Copyright 2009 Eat Local Food, LLC
 * Copyright (c) 2007 osCommerce (this file was written after
 * code review of osCommerce).
 *
 * This file is part of gwtCommerce.
 *
 * gwtCommerce is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 2 of the License, or
 * (at your option) any later version.
 *
 * gwtCommerce is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with gwtCommerce.  If not, see <http://www.gnu.org/licenses/>.
 */
package com.elf.gwt.common.client.model;

import com.google.gwt.json.client.JSONObject;

/**
 *  
 */
public class TaxRateModel extends AbstractModel
{
	protected int id = 0;
	protected int taxZoneId = 0;
	protected int taxClassId = 0;
	protected int priority = 0;
	protected double rate = 0.0;
	protected String description;

	
	public TaxRateModel()
	{
		id = -1;
		description = "";
	}

	public TaxRateModel(JSONObject jsonObject)
	{
		id = convertToInteger(jsonObject,"id");
		taxZoneId = convertToInteger(jsonObject,"tax_zone_id");
		taxClassId = convertToInteger(jsonObject,"tax_class_id");
		priority = convertToInteger(jsonObject,"priority");
		rate = convertToDouble(jsonObject,"rate");
		description = convertToString(jsonObject,"description");
	}
	
	public void update(TaxRateModel model)
	{
		id = model.getId();
		taxZoneId = model.getTaxZoneId();
		taxClassId = model.getTaxClassId();
		priority = model.getPriority();
		rate = model.getRate();
		description = model.getDescription();
	}

	public int getId() {
		return id;
	}
	public int getTaxZoneId() {
		return taxZoneId;
	}

	public int getTaxClassId() {
		return taxClassId;
	}

	public int getPriority() {
		return priority;
	}

	public double getRate() {
		return rate;
	}

	public String getDescription() {
		return description;
	}
}
